use crate::handle::{HandleManager, ExportPayload, ImportPayload};

use super::{RouterBuilder, utils::LibraryRequest};

pub(crate) fn mount() -> RouterBuilder {
    return RouterBuilder::new()
        .library_mutation("import", |t| {
            t(|_, args: ImportPayload, library| async move {
                let _ = HandleManager::import(library.db, args).await.map_err(|err| println!("{:?}", err)).ok();
            })
        })
        .library_mutation("export", |t| {
            t(|_, args: ExportPayload, library| async move {
                let _ = HandleManager::export(library.db, args).await.map_err(|err| println!("{:?}", err)).ok();
            })
        })
}
